﻿using System.Collections.Generic;
using UnityEngine;

/*�ųǽ���*/

public class Test_OnGUI1 : MonoBehaviour
{
    public string text;
    public float f;

    private void OnGUI()
    {
        //画按钮
        if (GUILayout.Button("测试"))
        {
            print("Hello");
        }
        if (GUILayout.Button("生成方块"))
        {
            GameObject.CreatePrimitive(PrimitiveType.Cylinder);
        }
        if (GUILayout.Button("放大镜"))
        {
            Camera.main.fieldOfView = 100;
        }
        //画文本标签Lable
        GUILayout.Label("如花似梦----------------------");
        //画输入框
        text = GUILayout.TextField(text);
        //画滑动条
        f = GUILayout.HorizontalSlider(f, 0, 100f);
    }
}

//手动布局
[ExecuteInEditMode]//编辑器状态下执行
public class Test_OnGUI : MonoBehaviour
{
    public Rect buttonRect;

    private void OnGUI()
    {
        if (GUI.Button(buttonRect, "开始游戏"))
        {
            print("开始游戏");
        }
    }
}